import $http from '../../../servers/http';
import { Result } from '../../schema/Result';
/* 短信模板管理
---------------------------------------------------------------- */
import {
  CreateSmsTempRequest,
  EditSmsTempRequest,
  SmsTempInfo,
  GetSmsTempListRequest,
} from '../../schema/SmsTemplate';
/**新增短信模板 */
export const createSmsTemp = (data: CreateSmsTempRequest): Promise<any> => {
  return $http.post({
    url: '/smstemplatemanage/smstemplates',
    data,
  });
};

/**修改短信模板 */
export const editSmsTemp = (id: number, data: EditSmsTempRequest): Promise<any> => {
  return $http.put({
    url: `/smstemplatemanage/smstemplates/${id}`,
    data,
  });
};
/**删除短信模板 */
export const deleteSmsTemp = (id: number): Promise<Result<null>> => {
  return $http.delete({
    url: `/smstemplatemanage/smstemplates/${id}`,
  });
};

/**批量删除短信模板 */
export const mulDelSmsTemp = (data: number[]): Promise<Result<null>> => {
  return $http.delete({
    url: '/smstemplatemanage/smstemplates',
    data: { smsTemplatise: data },
  });
};

/**查询短信模板列表 */
export const getSmsTempList = (data: GetSmsTempListRequest): Promise<Result<SmsTempInfo[]>> => {
  return $http.get({
    url: '/smstemplatemanage/smstemplates',
    data,
  });
};

/**查询短信模板详情 */
export const getSmsTempInfo = (id: number): Promise<Result<SmsTempInfo>> => {
  return $http.get({
    url: `/smstemplatemanage/smstemplates/${id}`,
  });
};
